#!/usr/bin/env python
# -*- coding: utf-8 -*-
#Intesim Python Script

gl.Table('dt4e')
table = gl.tables['dt4e']
table.interpolationType = InterpolationType.Linear
table.extrapolationType = ExtrapolationType.BHType2
table.argument = 'H'
table.outPutName = 'B'
table.setData( ( 0, 238.7, 318.3, 358.1, 437.7, 477.5, 636.6, 795.8, 1114.1, 1273.2, 1591.5, 2228.2, 3183.1, 4774.6, 6366.2, 7957.7, 15915.5, 31831, 47746.5, 63662, 79577.5, 159155, 318310, ), ( 0, 0.2003, 0.3204, 0.40045, 0.50055, 0.5606, 0.7908, 0.931, 1.1014, 1.2016, 1.302, 1.4028, 1.524, 1.626, 1.698, 1.73, 1.87, 1.99, 2.04, 2.07, 2.095, 2.2, 2.4, ) )
gl.loadMaterial('air')
gl.materials['air'].removeValue(MaterialProperty.AdvancedDensityType)
gl.materials['air'].removeValue(MaterialProperty.BoussinesqDensity)
gl.materials['air'].removeValue(MaterialProperty.ThermalExpansionCoefficient)
gl.materials['air'].removeValue(MaterialProperty.MolecularWeight)
gl.materials['air'].addType(MaterialType.Thermal)
gl.materials['air'].setValue(MaterialProperty.KZZ, ValueType.Value,  26.24)
gl.materials['air'].setValue(MaterialProperty.KYY, ValueType.Value,  26.24)
gl.materials['air'].setValue(MaterialProperty.KXX, ValueType.Value,  26.24)
gl.materials['air'].setValue(MaterialProperty.HCAPACITY, ValueType.Value,  1012000000)
gl.materials['air'].removeType(MaterialType.IronLoss)
gl.Material('dt4e')
gl.materials['dt4e'].addType(MaterialType.Magnetic_MUR)
gl.materials['dt4e'].setValue(MaterialProperty.MURX, ValueType.Table,  1)
gl.materials['dt4e'].setValue(MaterialProperty.MURY, ValueType.Table,  1)
gl.materials['dt4e'].setValue(MaterialProperty.MURZ, ValueType.Table,  1)
gl.materials['dt4e'].setValue(MaterialProperty.Density, ValueType.Value,  2e-07)
gl.materials['dt4e'].removeType(MaterialType.IronLoss)
gl.materials['dt4e'].value(MaterialProperty.Density).value = 2e-07
gl.materials['dt4e'].addType(MaterialType.Thermal)
gl.materials['dt4e'].setValue(MaterialProperty.KZZ, ValueType.Value,  20000)
gl.materials['dt4e'].setValue(MaterialProperty.KYY, ValueType.Value,  20000)
gl.materials['dt4e'].setValue(MaterialProperty.KXX, ValueType.Value,  20000)
gl.materials['dt4e'].setValue(MaterialProperty.HCAPACITY, ValueType.Value,  460000000)
gl.materials['dt4e'].setValue(MaterialProperty.Density, ValueType.Value,  7.5e-06)
gl.Material('coil')
gl.materials['coil'].addType(MaterialType.Thermal)
gl.materials['coil'].setValue(MaterialProperty.KZZ, ValueType.Value,  380000)
gl.materials['coil'].setValue(MaterialProperty.KYY, ValueType.Value,  380000)
gl.materials['coil'].setValue(MaterialProperty.KXX, ValueType.Value,  380000)
gl.materials['coil'].setValue(MaterialProperty.HCAPACITY, ValueType.Value,  380000000)
gl.materials['coil'].addType(MaterialType.Electro_RSV)
gl.materials['coil'].setValue(MaterialProperty.RSVZ, ValueType.Value,  0.00019025)
gl.materials['coil'].setValue(MaterialProperty.RSVY, ValueType.Value,  0.00019025)
gl.materials['coil'].setValue(MaterialProperty.RSVX, ValueType.Value,  0.00019025)
gl.materials['coil'].addType(MaterialType.Magnetic_MUR)
gl.materials['coil'].setValue(MaterialProperty.MURX, ValueType.Value,  1)
gl.materials['coil'].setValue(MaterialProperty.MURY, ValueType.Value,  1)
gl.materials['coil'].setValue(MaterialProperty.MURZ, ValueType.Value,  1)
gl.materials['coil'].setValue(MaterialProperty.Density, ValueType.Value,  8.95e-06)
Model.updateSolverList()
Model.updateSolverList()
Model.Model('model_1')
Model.models['model_1'].typeName = 'Thermal'
geomList = [['Part__Feature003', ['Face4']]]
Mesh.createPartsComponent(comp_name = 'Component1', geomNamelist = geomList)
geomList = [['Part__Feature003', ['Face2']]]
Mesh.createPartsComponent(comp_name = 'Component2', geomNamelist = geomList)
Model.models['model_1'].importComponent('Component1')
Model.models['model_1'].importComponent('Component2')
Model.models['model_1'].importComponent('Part__Feature')
Model.models['model_1'].importComponent('Part__Feature001')
Model.models['model_1'].importComponent('Part__Feature003')
Model.models['model_1'].importComponent('Part__Feature002')
component = Model.models['model_1'].componentList.at(2)
component.elementType = 'THERMAL_Tet4'
Mesh.setComponentToElemType('Part__Feature')
component = Model.models['model_1'].componentList.at(3)
component.elementType = 'THERMAL_Tet4'
Mesh.setComponentToElemType('Part__Feature001')
component = Model.models['model_1'].componentList.at(4)
component.elementType = 'THERMAL_Tet4'
Mesh.setComponentToElemType('Part__Feature003')
component = Model.models['model_1'].componentList.at(5)
component.elementType = 'THERMAL_Tet4'
Mesh.setComponentToElemType('Part__Feature002')
Model.models['model_1'].componentList.at(2).materialId = 3
Model.models['model_1'].componentList.at(3).materialId = 4
Model.models['model_1'].componentList.at(4).materialId = 2
Model.models['model_1'].componentList.at(5).materialId = 3
holeDataList = []
Mesh.createSharedTopoMeshBand(listFullName = ['Part__Feature001.Solid1', 'Part__Feature.Solid1', 'Part__Feature002.Solid1', 'Part__Feature003.Solid1'], additionGeomList = [], bandFullName = [], holeList = holeDataList, bandMotionType = 0, sharedTopoMeshType = 3, elemType = 'ETri', order = 1, tolerance = 0)
bc = Model.BoundaryCondition()
bc.type = 'Temperature'
bc.compId = 1
bc.value('TEMP').value = 25
bc.value('TEMP').type = ValueType.Value
bc.shellTDOF = ''
Model.models['model_1'].bcList.append(bc)
bc = Model.BoundaryCondition()
bc.type = 'Temperature'
bc.compId = 2
bc.value('TEMP').value = 25
bc.value('TEMP').type = ValueType.Value
bc.shellTDOF = ''
Model.models['model_1'].bcList.append(bc)
Mesh.saveFile('D:/softwareplaytation/thermal/3D/tr.xml')
Model.solvePhysicsModel('model_1')
Post.setView('ElementView')
Model.updateSolverList()
Post.openPostWindow('D:/softwareplaytation/thermal/3D/tr.model_1.model.res/tr.model_1.model_model_1_th_0001.res.inp', 'model_1')
scalar_plot = Post.newScalar('model_1')
scalar_plot.name = 'temperature'
scalar_plot.dataAdapterID = 0
scalar_plot.appendCompId( 3) 
scalar_plot.appendCompId( 4) 
scalar_plot.appendCompId( 6) 
scalar_plot.setDraw(True)
scalar_plot.min = 25
scalar_plot.max = 25
scalar_plot.length = 400
scalar_plot.dataCount = 12
scalar_plot.location = 0
scalar_plot.setAutoPosition(True)
scalar_plot.hideoutrange = False
scalar_plot.show()
del scalar_plot
bc = Model.BoundaryCondition()
bc.type = 'HeatGeneration'
bc.compId = 4
bc.value('HEATD').value = 5
bc.value('HEATD').type = ValueType.Value
bc.shellTDOF = ''
Model.models['model_1'].bcList.append(bc)
Model.solvePhysicsModel('model_1')
scalar_plot = Post.newScalar('model_1')
scalar_plot.name = 'temperature'
scalar_plot.dataAdapterID = 0
scalar_plot.appendCompId( 3) 
scalar_plot.appendCompId( 4) 
scalar_plot.appendCompId( 6) 
scalar_plot.setDraw(True)
scalar_plot.min = 25
scalar_plot.max = 25
scalar_plot.length = 400
scalar_plot.dataCount = 12
scalar_plot.location = 0
scalar_plot.setAutoPosition(True)
scalar_plot.hideoutrange = False
scalar_plot.show()
del scalar_plot
Post.updateResult('D:/softwareplaytation/thermal/3D/tr.model_1.model.res/tr.model_1.model_model_1_th_0001.res.inp','model_1')
Mesh.saveFile('D:/softwareplaytation/thermal/3D/tr.xml')
